home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / take1304.zip / TAKE1ST.DOC < prev    next >
Text File  |  1993-03-20  |  5KB  |  126 lines

  1. TAKE1ST.DOC
  2. 03/20/93
  3.  
  4. The TAKE1ST.EXE program goes through a text file and removes duplicate records.
  5. It presumes the file is already sorted by the desired columns.  You can use the
  6. Vern Buerg SORTF program if it's not ("SORTF infile outfile /+begincol,len").
  7. Typically, unique records are written out to an output file.
  8.  
  9. Command syntax:
  10.  
  11.     TAKE1ST infile outfile [ /COLUMNS { col1-col2 | col1 colct } ... ]
  12.       [ /LINES { line1-line2 | line1 linect } ... ]
  13.       [ /OVERWRITE | /APPEND | /-OVERWRITE | /OVERASK ]
  14.       [ /V | /-V ] [ /I | /-I ] [ /IN search ]
  15.       [ /UNIQUE | /DUPLICATES ] [ /GROUP=n ] [ /Q ] [ /? ]
  16.  
  17. where:
  18.  
  19. "infile" is the name of the file to process.
  20.  
  21. "outfile" is the name of the output file to create.
  22.  
  23. "/COLUMNS col1-col2" says to restrict the duplicate checking to certain columns;
  24. those columns between col1 and col2 inclusive.  So "TAKE1ST ORIGFILE NEWFILE
  25. /COLUMNS 1-10" would confine the search to just the text found in the first 10
  26. characters of each record.  You can have multiple column requests in any order
  27. such as "/COLUMNS 1-10 90-100 30-50".  Defaults to "/COLUMNS 1-100".
  28.  
  29. "/COLUMNS col1 colct" says to restrict the checking to just that text found in
  30. the colct columns beginning with col1.  For example, "TAKE1ST ORIGFILE NEWFILE
  31. /COLUMNS 10 5" will confine the search to just the text found in columns 10 to
  32. 14 (the 5 columns beginning will column 10) of each record.
  33.  
  34. "/OVERWRITE" says to overwrite the output file if it already exists.  If the
  35. file is not there, the option is ignored.
  36.  
  37. "/APPEND" says to append the new output to the output file if it exists already.
  38.  
  39. "/-OVERWRITE" says to abort if the output file exists already.
  40.  
  41. "/OVERASK" says to prompt if the output file exists already.  This is the
  42. default.
  43.  
  44. "/V" says to find those items that do NOT match the specification.
  45.  
  46. "/-V" is the opposite of /V and is typically the default; CONFIGWS-able.
  47.  
  48. "/I" says to make it a case-insensitive search.
  49.  
  50. "/-I" is the opposite of /I and is typically the default; CONFIGWS-able.
  51.  
  52. "search" restricts the search to lines which meet some string search
  53. specification.  The search itself is described below.
  54.  
  55.  
  56. "/UNIQUE" writes out just the unique lines.  /UNIQUE is typically the default;
  57. CONFIGWS-able.
  58.  
  59. "/DUPLICATES" (or anything that begins with "/DUP") writes out the duplicate
  60. entries instead.
  61.  
  62. "/GROUP=n" accepts the first n-number of records in the duplicate group.  This
  63. is primarily intended when you want to get something like the first three of
  64. each group.  Defaults to /GROUP=1.
  65.  
  66. "/Q" turns off the block-by-block status messages.
  67.  
  68. "/?" or "/HELP" or "HELP" shows you the syntax for the command.
  69.  
  70.  
  71. For search, the syntax is:
  72.   [ ( ]... search_item [ boolean [ ( ]... search_item [ ) ]...] [ ) ]...
  73. where:
  74.   ( and )     are used to group items
  75.   search_item is shown below
  76.   boolean     is AND, OR, or XOR (NOT is included with search_item)
  77.  
  78. for search_item, the syntax is:
  79.   [ NOT ]  "string" [ column ]
  80. where:
  81.   NOT         is obvious
  82.   string      the string to search; the quotation marks are typically not
  83.               required unless the string contains a space or a reserved word
  84.   column      is the column in which the string must be found.
  85.  
  86. So, let's cover some examples:
  87.  
  88.         TAKE1ST TEST.TXT TEST.OUT "Bugs Bunny" OR "Elmer Fudd" /COLS=1-10
  89.  
  90. Writes out the first unique row based on the contents of columns 1 to 10.  Only
  91. rows that contain either the text "Bugs Bunny" or "Elmer Fudd" in them are
  92. considered.
  93.  
  94.         TAKE1ST TEST2.TXT TEST2.OUT (Apples or Oranges) AND NOT Pears
  95.            /LINES=1-1000 /COLS=1/5
  96.  
  97. Writes out to TEST2.OUT the first unique row based on the contents of columns 1
  98. to 5.  Only the first 1000 rows are considered.  Each row must contain the words
  99. "Apples" or "Oranges" in them and any lines are ignored that contain "Pears".
  100. Note that the quotes around the search words are not required unless the words
  101. include spaces or unless they could be confused with some other keywords.
  102. "ATAKE1ST TEST3.TXT TEST3.OUT OR OR AND" might cause the program to get confused
  103. since "OR" and "AND", which you want to look for as also keywords.
  104.  
  105.  
  106.         TAKE1ST /I TEST.TXT TEST.OUT "Bugs Bunny" AND Martians
  107.  
  108. Writes out all unique lines (based on the contents of columns 1 to 100) in
  109. TEST.TXT that contain both "Bugs Bunny" and "Martians".  The search is
  110. case-insensitive so "BUGS BUNNY" and "Bugs Bunny" will both show up.
  111.  
  112.  
  113. This program was written by Bruce Guthrie of Wayne Software.  It is free for use
  114. provided relevant documentation is kept with the program, no changes are made to
  115. the program or documentation, and it is not bundled with commercial programs or
  116. charged for separately.  People who need to bundle it in for-sale packages must
  117. pay a $50 registration fee to "Wayne Software" at the following address.
  118. Comments and suggestions can also be sent to:
  119.  
  120.                 Bruce Guthrie
  121.                 Wayne Software
  122.                 113 Sheffield St.
  123.                 Silver Spring, MD 20910
  124.  
  125.                 fax: (301) 588-8986
  126.